/**
 * related to listRowTemplate.ui
 * 
 * @Author : chenglm
 * @Timestamp : 2016-07-15
 */
var root=ui("$");
var nf = sm("do_Notification");
var helperOpen = require("helper/open");
var helperOrder = require("helper/order");
var do_Label_num = ui("do_Label_num");
var do_ALayout_order = ui("do_ALayout_order");
var do_ImageView_img = ui("do_ImageView_img");
var do_Label_title = ui("do_Label_title");
var do_Label_time = ui("do_Label_time");
var do_Label_orderStatus = ui("do_Label_orderStatus");
var do_Label_total = ui("do_Label_total");
var do_Button_sended = ui("do_Button_sended");
var do_Button_cancel = ui("do_Button_cancel");
var do_Button_comment = ui("do_Button_comment");
var do_Button_complete = ui("do_Button_complete");
var do_Label_total = ui("do_Label_total");
var do_Button_cancel2 = ui("do_Button_cancel2");
var layoutBtn = ui("layoutBtn");
//设置数据绑定的映射关系
root.setMapping({
	"do_Label_num.text":"orderNo",
	"do_Label_num.tag":"orderType",
	"do_ImageView_img.source":"fullImg",
	"do_Label_title.text":"title",
	"do_Label_time.text":"strNewAt",
	"do_Label_orderStatus.tag":"orderStatus",
	"do_Label_total.text":"total",
	"do_Button_sended.tag":"payStatus",
	"do_Button_comment.tag":"commentStatus",
	"do_Button_complete.tag" : "deliveryStatus",
	"do_Label_10.text" :"buyerNick",
	"do_Label_orderStatus.text" : "orderStatusText",
});

root.on("dataRefreshed", function(){
	do_Label_total.text = "￥" + do_Label_total.text;
});

do_ALayout_order.on("touch", function(data){
	var orderNo = do_Label_num.text;
	helperOpen.open("source://view/order/seller/detail.ui", {orderNo : orderNo});
});

do_Button_sended.on("touch", function(data){
	nf.confirm("确认?", "", "确定", "取消", function(data, e) {
		if(do_Label_num.tag == 4){
			helperOrder.sellerSended(do_Label_num.text,'2',null,null,'1',function(data,e){
				layoutBtn.visible=false;
			});
		}else if(do_Label_num.tag == 3){
			helperOrder.sellerSended(do_Label_num.text,'2',null,null,'1',function(data,e){
				layoutBtn.visible=false;
			});
		}
	});
});
